package com.tengju.bff.infrastructure.export.repo;

import com.tengju.bff.infrastructure.export.convert.TableVoConvert;
import com.tengju.bff.interfaces.manage.crm.activity.facade.ActivityTargetAnalysisFacade;
import com.tengju.bff.interfaces.manage.crm.activity.form.ActivityDirectorQuery;
import com.tengju.export.domain.record.ExportDataSourceRepository;
import com.tengju.export.domain.record.Query;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: 大木
 * @date: 2022/1/13 10:09 上午
 */
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Service("directorTargetReachExportDataSourceRepository")
public class DirectorTargetReachExportDataSourceRepository implements ExportDataSourceRepository {

    private final ActivityTargetAnalysisFacade activityTargetAnalysisFacade;

    @Override
    public Object batchFindDataSource(Query query) {
        ActivityDirectorQuery pageQuery = (ActivityDirectorQuery) query;
        pageQuery.setPageSize(100000);
        pageQuery.setPageIndex(1);
        return TableVoConvert.convert(activityTargetAnalysisFacade.directorTargetReachTable(pageQuery));
    }
}